﻿namespace System.Workflow.ComponentModel.Serialization
{
    using System;
    using System.Runtime.Serialization;
    using System.Security.Permissions;

    [Serializable]
    public class WorkflowMarkupSerializationException : Exception
    {
        private int columnNumber;
        private int lineNumber;

        public WorkflowMarkupSerializationException()
        {
            this.lineNumber = -1;
            this.columnNumber = -1;
        }

        public WorkflowMarkupSerializationException(string message) : base(message)
        {
            this.lineNumber = -1;
            this.columnNumber = -1;
        }

        protected WorkflowMarkupSerializationException(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            this.lineNumber = -1;
            this.columnNumber = -1;
        }

        public WorkflowMarkupSerializationException(string message, Exception innerException) : base(message, innerException)
        {
            this.lineNumber = -1;
            this.columnNumber = -1;
        }

        public WorkflowMarkupSerializationException(string message, int lineNumber, int columnNumber) : base(message)
        {
            this.lineNumber = -1;
            this.columnNumber = -1;
            this.lineNumber = lineNumber;
            this.columnNumber = columnNumber;
        }

        public WorkflowMarkupSerializationException(string message, Exception innerException, int lineNumber, int columnNumber) : base(message, innerException)
        {
            this.lineNumber = -1;
            this.columnNumber = -1;
            this.lineNumber = lineNumber;
            this.columnNumber = columnNumber;
        }

        [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
        }

        public int LineNumber
        {
            get
            {
                return this.lineNumber;
            }
        }

        public int LinePosition
        {
            get
            {
                return this.columnNumber;
            }
        }
    }
}

